import { defineStore } from "pinia";
import { getCardList } from "@/api";
let cardList=$ref<any[]>([]);
let cardlist1 = getCardList();
  let cardList2=$ref<any[]>([])
  cardlist1.data.forEach((Item)=>{
    Item.productList.forEach((items)=>{
        cardList.push(items)
    })
  })
  let sercherIf=ref(0)
export const usestore=defineStore('main',{
    state(){
        return{
            cardList,
            sercherIf,
            cardList2
        }
    },
    getters:{

    },
    actions:{
      Search(revole: String) {
        this.cardList=this.cardList.filter((item: { title: string; }) =>
      item.title.toLowerCase().includes(revole.toLowerCase())
    )
    }
    }
})